#ifndef __MAP_ALLOCATOR_H__
#define __MAP_ALLOCATOR_H__

#pragma once

#include <MemoryPoolFactory.h>
using namespace util;

class Map;
class MapInfoLoader;
class Field;
class Sector;
class Zone;
class SectorGroup;


class MapAllocator
{
public:
	MapAllocator();
	~MapAllocator();

	VOID							Init( DWORD MapPoolSize, DWORD SectorPoolSize, WORD wVillageSectorSize, WORD wRoomSectorSize );
	VOID							Release();

	Map *							AllocMap( MAPID sid, int iFieldIndex );
	VOID							FreeMap( Map * pMap );

private:
	MapInfoLoader *						m_pMapInfoLoader;
	CMemoryPoolFactory<Map> *			m_pMapPool;
	CMemoryPoolFactory<Field> *			m_pFieldPool;
	CMemoryPoolFactory<Sector> *		m_pSectorPool;
	CMemoryPoolFactory<SectorGroup> *	m_pSectorGroupPool;
};

extern MapAllocator g_MapAllocator;

#endif // __MAP_ALLOCATOR_H__